<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 还可以先排序再比较，排序之后相同数据在一起
      /**
       * @param {number[]} nums
       * @return {boolean}
       */
      var containsDuplicate = function (nums) {
        for(var i = 0; i< nums.length;i++) {
          for(var j = i+1;j < nums.length;j++){
            if(nums[i] === nums[j]) return true
          }
        }
        return false
      };

      var nums = [2,14,18,22,22]
      console.log(containsDuplicate(nums));
    </script>
  </body>
</html>
